Skip to content

Conversation

@eduardb
Copy link
Contributor

@eduardb eduardb commented Aug 25, 2022

Following the suggestion from here:

A quick fix might be to do the merge in RealResponseWriter so that we do not overwrite the entries in buffer. The different values will come from different ResponseField but maybe it's not a big issue.

Also added an integration test based on the reproducer, as suggested by @BoD (thank you!).

@netlify
Copy link

netlify bot commented Aug 25, 2022

👷 Deploy request for apollo-android-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 0c04a41

Copy link
Contributor

@BoD BoD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thanks a lot 🙏

.build()
.await()

assertThat(cacheResponse.data?.home?.sectionA?.name).isEqualTo("modifiedSectionName")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a check that the fragment is correctly written?

Suggested change
assertThat(cacheResponse.data?.home?.sectionA?.name).isEqualTo("modifiedSectionName")
assertThat(cacheResponse.data?.home?.sectionA?.name).isEqualTo("modifiedSectionName")
assertThat(cacheResponse.data?.home?.fragments?.sectionFragment?.sectionA?.imageUrl).isEqualTo("modifiedUrl")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 0c04a41. Thanks!

Copy link
Contributor

@martinbonnin martinbonnin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small comment but looks good to me, thanks!

@martinbonnin martinbonnin merged commit 461c5f7 into apollographql:release-2.x Aug 29, 2022
@martinbonnin
Copy link
Contributor

Thanks for the contribution!

@eduardb eduardb deleted the fix-overwrites-cache-entries-when-using-fragments branch August 29, 2022 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants